<?php

header("Content-Type: application/json");
include('../../include/functions.inc.php');
$teacher = sqlValue(getParam("ID"), "text");
$selectedCycle = sqlValue(getParam("CYCLE"), "int");
$sql = "select a.ID,a.FK_COURSE,b.NAME,a.SECTION from cllg_teacher_assign a inner join
     cllg_courses_catalog b on a.FK_COURSE=b.CODE
     where a.FK_TEACHER=$teacher AND a.FK_CYCLE=$selectedCycle ORDER BY a.FK_COURSE ";

$courses = $db->query_toJson_sql($sql, array("ID" => "ID", "CODIGO_CURSO" => "FK_COURSE",
    "NOMBRE" => "NAME", "SECCION" => "SECTION"));

echo $courses;
?>